import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex);

var isloginlocal;
uni.getStorage({
	key: 'islogin',
	success: function (res) {
		isloginlocal= res.data;
	}
})
var localnub;
uni.getStorage({
	key: 'fontsizenub',
	success: function (res) {
		localnub= res.data;
	}
})
var localdetail;
uni.getStorage({
	key: 'fontsizedetail',
	success: function (res) {
		localdetail= res.data;
	}
})
localnub=localnub?localnub:3;
localdetail=localdetail?localdetail:3;

var localavatarUrl = uni.getStorageSync('avatarUrl')
var localnickName = uni.getStorageSync('nickName')
const store = new Vuex.Store({
 state : {
  fontsizenub:localnub,
  fontsizedetail:localdetail,
  islogin:isloginlocal,
  avatarUrl:localavatarUrl,
  nickName:localnickName
 },
 getters:{
	 
 },
 mutations : {
  changelist:function(state,list){
	  state.list = list
  },	
  changesize : function(state, val){
		state.fontsizenub =val;
  },
  changedetail : function(state, val){
  		state.fontsizedetail =val;
  },
  changeAvatarUrl:function(state,val){
	  state.avatarUrl = val;
  },
  isloginfn:function(state,val){
	  state.islogin = val;
  },
  changeNickName:function(state,val){
	  state.nickName = val;
  }
 }
});
export default store